#!/usr/bin/env python
import smtplib
from email.mime.text import MIMEText

def send_mail(to_list,sub,content):
    mail_host="smtp.exmail.qq.com"
    
    mail_user="liaohu"
    mail_user_full="liaohu@58.com"
    mail_pass="aidsoi248512"
    me=mail_user+"<%s>"%mail_user_full
    
    #print me
    msg = MIMEText(content)
    msg['Subject'] = sub
    msg['From'] = me
    msg['To'] = to_list
    try:
        s = smtplib.SMTP()
        s.connect(mail_host)
        s.login(mail_user_full,mail_pass)
        s.sendmail(me, to_list, msg.as_string())
        s.close()
        #print '1'
        return True
    except Exception, e:
        #print '2'
        print str(e)
        return False